package cn.edu.ecut.se2024.service;

import cn.edu.ecut.se2024.dao.ShoppingCartDao;
import cn.edu.ecut.se2024.exception.OperationFailedException;
import cn.edu.ecut.se2024.model.ShoppingCart;
import org.apache.coyote.Request;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ShoppingCartService {
    private final ShoppingCartDao shoppingCartDao;

    public ShoppingCartService(ShoppingCartDao shoppingCartDao) {
        this.shoppingCartDao = shoppingCartDao;
    }

    public List<ShoppingCart> queryMyCarts(int userId, String searchInput) throws OperationFailedException {
        List<ShoppingCart> shoppingCart = shoppingCartDao.queryMyCarts(userId, searchInput);

        return shoppingCart;

    }

    public List<ShoppingCart> showMyCarts(int userId) throws OperationFailedException {
        List<ShoppingCart> shoppingCart = shoppingCartDao.showMyCarts(userId);

        return shoppingCart;
    }
}
